{% extends "base_generic.html" %}

{% block content %}
  <div class="card">
    <div class="card-header bg-primary text-white">
      <h4 class="mb-0"><i class="fas fa-key me-2"></i>设置新密码</h4>
    </div>
    <div class="card-body">
      {% if validlink %}
        <p>请输入并确认您的新密码。</p>
        <form method="post">
          {% csrf_token %}
          <div class="mb-3">
            <label for="id_new_password1" class="form-label">新密码</label>
            <input type="password" name="new_password1" id="id_new_password1" class="form-control" required>
          </div>
          <div class="mb-3">
            <label for="id_new_password2" class="form-label">确认密码</label>
            <input type="password" name="new_password2" id="id_new_password2" class="form-control" required>
          </div>
          <div class="d-grid gap-2">
            <button type="submit" class="btn btn-primary">设置密码</button>
          </div>
        </form>
      {% else %}
        <div class="alert alert-danger">
          <p>密码重置链接无效，可能是因为该链接已被使用或已过期。</p>
          <p>请重新申请密码重置。</p>
        </div>
        <div class="mt-3">
          <a href="{% url 'password_reset' %}" class="btn btn-primary">重新申请密码重置</a>
        </div>
      {% endif %}
    </div>
  </div>
{% endblock %} 